﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>客户管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />

    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/JqueryPlug/dtGrid/jquery.dtGrid.css" rel="stylesheet">
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/JqueryPlug/dtGrid/jquery.dtGrid.js"></script>
    <script>
        var grid, dtoption;

        //获取主要菜单
        dtoption = {
            lang: 'zh-cn',
            check: false,
            ajaxLoad: false,
            exportFileName: '客户列表',
            columns: [
                 { id: 'ID', title: '序号', type: 'string', columnClass: 'text-center', hide: true },
                { id: 'KHName', title: '客户名称', type: 'string', columnClass: 'text-center' },
                { id: 'BranchName', title: '所属部门', type: 'string', columnClass: 'text-center' },
                { id: 'KHLeiBie', title: '客户类别', type: 'string', columnClass: 'text-center' },
                { id: 'KHDW', title: '单位名称', type: 'string', columnClass: 'text-center' },
                { id: 'KHPhone', title: '联系号码', type: 'string', columnClass: 'text-center' },
                { id: 'KHAdress', title: '联系地址', type: 'string', columnClass: 'text-center' },
            { id: 'KHZhiWu', title: '客户职务', type: 'string', columnClass: 'text-center'},
            { id: 'KHXinBie', title: '性别', type: 'string', columnClass: 'text-center' },
                { id: 'CRDate', title: '创建时间', type: 'string', columnClass: 'text-center' },
            {
                id: 'KHFXRS', title: '负责人', type: 'string', columnClass: 'text-center', hideType: 'lg|md|sm|xs', resolution: function (value, record, column, grid, dataNo, columnNo) {
                    return ComFunJS.convertuser(record.KHFXRS);
                }
            },
            { id: 'Remark', title: '备注', type: 'string', columnClass: 'text-center',hideType: 'lg|md|sm|xs' }],
            gridContainer: 'dtgrid',
            toolbarContainer: 'dtgridTool',
            pageSize: 8,
            pageSizeLimit: [10, 20, 50],
            tools: 'faseQuery',
            onGridComplete: function (grid) {
                var log = '<p>表格加载完成。表格编号：' + grid.option.id + '。</p>';
            }
        };
        var model = avalon.define({
            $id: "KHRZLIST",
            KHType: "",
            KHContent: "",
            KHTypeData: [],
            KHBranchData: [],
            CommonData: [],
            branchName: "",
            GetKHType: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 8 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.KHTypeData = resultData.Result;
                        model.KHBranchData = resultData.Result1;
                    }
                })
            },
            GetKHData: function () { 
                $.getJSON('/API/FTAPI.ashx?Action=GETKHGLDATA', { P1: model.KHType, P2: model.KHContent, b: model.branchName }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.CommonData = resultData.Result;
                        if (dtoption.datas != undefined) {
                            dtoption.originalDatas = model.CommonData;

                        } else {
                            dtoption.datas = model.CommonData;
                            grid = $.fn.DtGrid.init(dtoption);
                        }
                        grid.load() 
                    }
                })
            }
        });
        avalon.ready(function () {
            model.GetKHType();
            model.GetKHData();
        })

        $(function () {

            $(".hidPan").click(function () {
                $(this).parent().find(".panel-body,.panel-footer").toggle('normal')
            })  
        });
    </script>

</head>
<body ms-controller="KHRZLIST">
    <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent">
        <div style="width:200px;position:absolute">
          
            <div class="list-group ">
                <a href="/View/APPBaseView/APP_KHGL.html" class="list-group-item " style="padding-left: 15px"><span class="glyphicon glyphicon-list"></span>&nbsp;&nbsp;我的客户</a>
                <a href="/View/APPBaseView/APP_KHGL_BranchList.html" class="list-group-item active" style="padding-left: 15px"><span class="glyphicon glyphicon-list"></span>&nbsp;&nbsp;部门客户</a>
            </div>
        </div>
        <div class="row contentdv" style="margin-left:201px">
            <div class="col-xs-12 ">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-xs-10">
                                <div class="input-group">
                                    <div class="input-group-addon">查询条件</div>
                                    <select class="form-control" ms-duplex="KHType" style="width:25%" ms-change="GetKHData()">
                                        <option value="">全部客户类别</option>
                                        <option ms-attr-val="item.TypeNO" ms-repeat-item="KHTypeData">{{item.TypeNO}}</option>
                                    </select>
                                    <input id="tbSearch" class="form-control" style="width:75%" type="text" ms-duplex="KHContent" placeholder="输入客户姓名,单位名称,联系号码查询" />
                                    <span class="input-group-btn">
                                        <button class="btn btn-info" ms-click="GetKHData()">查询</button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-xs-2">
                            </div>
                        </div>
                    </div>

                </div>
                <div id="dtgrid" style="margin-top:20px"></div>
                <div id="dtgridTool" class="dt-grid-toolbar-container"></div>
                <!-- Table -->

            </div>
        </div>
    </div>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js" type="text/javascript"></script>
    <script type="text/javascript" src="/JqueryPlug/layer/layer/layer.js"></script>
    <link href="/JqueryPlug/umeditor122/themes/default/css/umeditor.css" type="text/css" rel="stylesheet" />
    <script src="/JqueryPlug/umeditor122/umeditor.js" type="text/javascript" charset="utf-8"></script>
    <script src="/JqueryPlug/umeditor122/umeditor.config.js" type="text/javascript" charset="utf-8"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
</body>
</html>
